﻿#Add-PSSnapIn Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
if ((Get-PSSnapin -Name Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue) -eq $null ) {
	Add-PSSnapin Microsoft.SharePoint.Powershell
}

Get-SPServer | ? { $_.Role -eq "Application" } | ForEach-Object { 
	$server = $_.Address;
	Invoke-Command -ComputerName $server { Remove-Item "C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\TEMPLATE\LAYOUTS\F5HeathCheck.aspx" -force }
	Invoke-Command -ComputerName $server { Remove-Item "C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\TEMPLATE\LAYOUTS\Scripts\*" -recurse -force }
	Write-Host "Clean up the front-end server: $server"
}